unit objectwin;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TObjectPalette = class(TForm)
    Components: TListBox;
    procedure ComponentsMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  ObjectPalette: TObjectPalette;

implementation

{$R *.dfm}

procedure TObjectPalette.ComponentsMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
    if Button = mbLeft then { drag only if left button pressed }
    with Sender as TListBox do { treat Sender as TFileListBox }
    begin
      if ItemAtPos(Point(X, Y), True) >= 0 then { is there an item here? }
        BeginDrag(False); { if so, drag it }
    end;

end;

end.
